package com.wqr.it.ecwdr.vo;

import java.text.SimpleDateFormat;
import java.util.Date;

/**
 * 产品销售信息
 * @author adinos
 *
 */
public class ProductSalesInfoVO extends ProductItemVO {
	private static final long serialVersionUID = 7533099327393391672L;
	private SallerVO sallerVO;
	private String listPrice;
	private String shipping;
	private int freeShipping = 0;
	private DeliveryVO deliveryVO; 
	private ProductCartSalesInfoVO productCartSalesInfoVO;
	private String addCartUrl;
	private String param;
	private int productSallerId = -1;
	private String sku;
	private String itemId;
	private static String collectPoint = null;
	private static long curToken = -1;
	private static String basePath = null;
	
	static {
		if (collectPoint == null) {
			SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm");
			collectPoint = dateFormat.format(new Date());
			setCurToken(((new Date()).getTime() - 1388505600000L) / 60000);
		}
	}
	
	/**
	 * @return the sallerVO
	 */
	public SallerVO getSallerVO() {
		return sallerVO;
	}
	/**
	 * @param sallerVO the sallerVO to set
	 */
	public void setSallerVO(SallerVO sallerVO) {
		this.sallerVO = sallerVO;
	}
	/**
	 * @return the shipping
	 */
	public String getShipping() {
		return shipping;
	}
	/**
	 * @param shipping the shipping to set
	 */
	public void setShipping(String shipping) {
		this.shipping = shipping;
	}
	/**
	 * @return the deliveryVO
	 */
	public DeliveryVO getDeliveryVO() {
		return deliveryVO;
	}
	/**
	 * @param deliveryVO the deliveryVO to set
	 */
	public void setDeliveryVO(DeliveryVO deliveryVO) {
		this.deliveryVO = deliveryVO;
	}
	/**
	 * @return the productCartSalesInfoVO
	 */
	public ProductCartSalesInfoVO getProductCartSalesInfoVO() {
		return productCartSalesInfoVO;
	}
	/**
	 * @param productCartSalesInfoVO the productCartSalesInfoVO to set
	 */
	public void setProductCartSalesInfoVO(ProductCartSalesInfoVO productCartSalesInfoVO) {
		this.productCartSalesInfoVO = productCartSalesInfoVO;
	}
	/**
	 * @return the addCartUrl
	 */
	public String getAddCartUrl() {
		if (addCartUrl != null) {
			return basePath + addCartUrl;
		} else {
			return null;
		}
	}
	/**
	 * @param addCartUrl the addCartUrl to set
	 */
	public void setAddCartUrl(String addCartUrl) {
		this.addCartUrl = addCartUrl;
	}
	/**
	 * @return the param
	 */
	public String getParam() {
		return param;
	}
	/**
	 * @param param the param to set
	 */
	public void setParam(String param) {
		this.param = param;
	}
	
	/**
	 * 设置产品信息
	 * @param productItemVO 产品信息
	 */
	public ProductSalesInfoVO setProductItemInfo(ProductItemVO productItemVO) {
		if (productItemVO != null) {
			this.setId(productItemVO.getId());
			this.setNumber(productItemVO.getNumber());
			this.setName(productItemVO.getName());
			this.setDescription(productItemVO.getDescription());
			this.setCategoryId(productItemVO.getCategoryId());
			this.setVersion(productItemVO.getVersion());
			this.setSallerId(productItemVO.getSallerId());
			this.setCountryId(productItemVO.getCountryId());
			this.setSourceId(productItemVO.getSourceId());
			//this.setSallerId(productItemVO.getSallerId());
		}
		return this;
	}
	/**
	 * @return the basepath
	 */
	public static String getBasePath() {
		return basePath;
	}
	public Object getSimpleInfo() {
		return "ProductSalesInfoVO [id = " + this.getId()
			+ (getIndex() > -1 ? ", index = " + getIndex() : "")
			+ ", sallerId = " + this.getSallerId()
			+ ", sallerSN = " + (this.getSallerVO() != null ? this.getSallerVO().getSn() : null)
			+ ", price = " + this.getPrice()
			+ ", stock = " + this.getStock()
			+ ", fba = " + this.getFba()
			+ ", prime = " + this.getPrime()
			+ ", stockId = " + this.getStockId()
			+ ", asin = " + this.getNumber()
			+ ", productName = " + this.getName();
	}
	

	/**
	 * @return the collectPoint
	 */
	public static String getCollectPoint() {
		return collectPoint;
	}
	/**
	 * @param collectPoint the collectPoint to set
	 */
	public static void setCollectPoint(String collectPoint) {
		ProductSalesInfoVO.collectPoint = collectPoint;
	}
	/**
	 * @return the productSallerId
	 */
	public int getProductSallerId() {
		return productSallerId;
	}
	/**
	 * @param productSallerId the productSallerId to set
	 */
	public void setProductSallerId(int productSallerId) {
		this.productSallerId = productSallerId;
	}
	/**
	 * @return the token
	 */
	public static long getCurToken() {
		return curToken;
	}
	/**
	 * @param token the token to set
	 */
	public static void setCurToken(long curToken) {
		ProductSalesInfoVO.curToken = curToken;
	}
	public String getListPrice() {
		return listPrice;
	}
	public void setListPrice(String listPrice) {
		this.listPrice = listPrice;
	}
	public int getFreeShipping() {
		return freeShipping;
	}
	public void setFreeShipping(int freeShipping) {
		this.freeShipping = freeShipping;
	}
	/**
	 * @return the sku
	 */
	public String getSku() {
		return sku;
	}
	/**
	 * @param sku the sku to set
	 */
	public void setSku(String sku) {
		this.sku = sku;
	}
	/**
	 * @return the itemId
	 */
	public String getItemId() {
		return itemId;
	}
	/**
	 * @param itemId the itemId to set
	 */
	public void setItemId(String itemId) {
		this.itemId = itemId;
	}
	@Override
	public String toString() {
		return "ProductSalesInfoVO [number=" + getNumber() + ", sallerVO=" + sallerVO + ", listPrice=" + listPrice + ", shipping=" + shipping
				+ ", freeShipping=" + freeShipping + ", deliveryVO=" + deliveryVO + ", productCartSalesInfoVO="
				+ productCartSalesInfoVO + ", addCartUrl=" + addCartUrl + ", param=" + param + ", productSallerId="
				+ productSallerId + ", sku=" + sku + ", itemId=" + itemId + "]" + super.toString();
	}
	
	
}
